<weather xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="weather.xsd">
  <dates>{
  let $doc := doc('weather.txt')//tr[@class="portlet-table-body" or @class="portlet-table-alternate"]
  
  for $tr in $doc
    where $tr/td[@valign="middle"]
    return 
      let $name := $tr/td[@valign="middle"]/text()
      let $tr2 := $tr/following-sibling::*[1]
      let $tr3 := $tr/following-sibling::*[2]
      let $sequence := ($tr, $tr2, $tr3)
      return <area>{attribute{"region"}{$name}} {
        for $t in $sequence 
        return 
        let $numbers := $t/td[@class="number"]
        let $type := $t/td[not(.//@*)]/text()
        return <type>{attribute{"type"}{$type}}{
          for $number in $numbers
          let $cislo := count($number/preceding-sibling::*[@class="number"])+1
          return 
          if($cislo=13) 
          then
                       <date>
                       {replace($number/text(), ',', '.')}</date>

          else         <date>{attribute{"month"}{$cislo}}
                       {replace($number/text(), ',', '.')}</date>
        }</type>
      }</area>
   
}</dates>
</weather>